#!/bin/bash
line=1;
OIFS=$IFS
IFS=$'\n';
echo '[';
for l in $(grep -Ee ' = \"(\\n|(\w|-)+( (\w|-)+))+.*\"' -e " = 'bwipp\..*$" < "$1"); do
  a=0
  if [ $((line % 2)) = 1 ]; then
    flag="$(echo $l | cut -f 2 -d "'")";
    echo -n "[\"$flag\",";
    case $flag in
      "bwipp.GS1badPercentEscape")
        echo "\"\"],";
        line=$((line+1));;
      "bwipp.unknownFNC")
        echo "\"\"],";
        line=$((line+1));;
      "bwipp.GS1couponBadDontMultiplyFlag")
        echo "\"\"],";
        line=$((line+1));;
      "bwipp.debugcws")
        echo "\"\"],";
        line=$((line+1));;
      "bwipp.debugecc")
        echo "\"\"],";
        line=$((line+1));;
    esac;
  else
    text="$(echo $l | cut -f 2 -d '"')";
    echo "\"$text\"],";
  fi;
  line=$((line+1));
done;
IFS=$OIFS
